title: Check if a temporary table exists and delete if it exists before creating a temporary table
body: <p>I am using the following code to check if the temporary table exists and drop the table if it exists before creating again. It works fine as long as I don't change the columns. If I add a column later, it will give an error saying "invalid column". Please let me know what I am doing wrong.</p>
  
  <pre><code>IF OBJECT_ID('tempdb..#Results') IS NOT NULL
      DROP TABLE #Results
  
  CREATE TABLE #Results
  (
      Company                CHAR(3),
      StepId                TINYINT,
      FieldId                TINYINT,
  )
  
  select company, stepid, fieldid from #Results
  
  --Works fine to this point
  
  IF OBJECT_ID('tempdb..#Results') IS NOT NULL
      DROP TABLE #Results
  
  CREATE TABLE #Results
  (
      Company                CHAR(3),
      StepId                TINYINT,
      FieldId                TINYINT,
      NewColumn            NVARCHAR(50)
  )
  
  select company, stepid, fieldid, NewColumn from #Results
  
  --Does not work
  </code></pre>