title: Using dynamic SQL to specify a column name by adding a variable to simple sql query
body: <p>sql 2005/ sql 2008</p>
  
  <pre><code>Declare @temp nvarchar(1000)
  
  set @temp = 'ABC'
  
  
  select col1,col2 from tableA
  </code></pre>
  
  <p>Along with select query, how to add a variable to the select query ?</p>
  
  <pre><code>expected output :-
  
  select col1,col2,@temp as [col3] from tableA
  </code></pre>
  
  <p>Where @temp specifies the name of a column in tableA.</p>