title: Use variable Column name in Select statement on SQL server 2008
body: <p>I would like to select a value from a table using the Column name AS  A VARIABLE !</p>
  
  <p>eg</p>
  
  <pre><code>DECLARE @spalte as varchar(10) 
  SET @spalte = 'Ecomp'
  
  SELECT @spalte FROM dbo.MATDATA WHERE  2&gt;= tmin AND 2&lt;=tmax AND 1 = MatCode
  </code></pre>
  
  <p>When I try to do this I only get 'Ecomp' back, not the expected value.</p>
  
  <p>Any idea?</p>