title: Conditional ORDER BY not working for temp table
body: <p>For the following simplified T-SQL statement</p>
  
  <pre><code>DECLARE @SortColumn nvarchar(50)
  SET @SortColumn = 'Price'
  
  SELECT Name, 1+1 as Price
  INTO #MyTempTable
  FROM Events
  ORDER BY 
      CASE 
         WHEN @SortColumn = 'Name' THEN Name 
      END,
      CASE 
         WHEN @SortColumn = 'Price' THEN Price 
      END DESC
  </code></pre>
  
  <p>Why do I get the error:</p>
  
  <blockquote>
    <p>Invalid column name 'Price'.</p>
  </blockquote>
  
  <p>Is it possible to sort on a calculated column?</p>
  
  <p>Note that my actual problem is part of a much more complex query, but this simplified example does demonstrate the problem and will throw an error.</p>