title: SQL SERVER: I would like to transfer my data to another column of the same table before droping the first one
body: <p>I am having problems with some of my SQL scripts on SQL SERVER, indeed I am trying to transfer data from a column A to a column B of the same table and then drop the column B,</p>
  
  <p>However my problem is that I have to check for the existence of A beforehand because the code is meant to be executed on a server where I don't have access (I work as a third party developper on a professionnal app)</p>
  
  <p>Here is my code:</p>
  
  <pre><code>-- Export the data from the column name
  -- Drop the column name
  
  USE p_mynacellelocation_db_ChecklistWPF
  GO
  
  
  IF COL_LENGTH('model_trolley_part','name') IS NOT NULL
  BEGIN
  UPDATE model_trolley_part
  SET name_en=[name];
  
  ALTER TABLE model_trolley_part
  DROP COLUMN [name];
  END
  </code></pre>
  
  <p>In the case of the column name being non existent I would like not to do anything</p>
  
  <p>However on execution of the code in a database where the column name is non existent SQL Server returns me:</p>
  
  <blockquote>
    <p>Msg 207, Level 16, State 1,  Line 12 Invalid column name 'name'.</p>
  </blockquote>