title: Pass Column names for a Select Query to retrieve from temporary table
body: <p>I had a temporary table that contains the column names that I want to retrieve from the specific table (table A). </p>
  
  <p>Here's the sample code:</p>
  
  <pre><code>Declare @temp table (ColumnNames varchar(30))
  
  insert into @temp 
  values('Name'), ('Class'), ('School')
  
  --select Query to retrieve only name,class and School columns
  end
  </code></pre>
  
  <p>Here table A contains more than 10 columns</p>