title: Renaming column does not allow to use it in batch
body: <p>I need to do some updates and rename a column if it has old name, so am trying to do like this:</p>
  
  <pre><code>GO
  IF NOT EXISTS (SELECT * FROM sys.columns WHERE Name = N'NewColumn' AND OBJECT_ID = OBJECT_ID(N'Potatoes'))
  BEGIN
      UPDATE Potatoes SET OldColumn = 4 WHERE SomeColumn = 1
      EXEC SP_RENAME 'dbo.Potatoes.OldColumn', 'NewColumn', 'COLUMN';     
  END
  GO
  </code></pre>
  
  <p>Script works fine first time, but while run again enterpreter can't find column named <code>OldColumn</code> and returns error. How can I use a column and rename it in a single batch?</p>