title: case statement in WHERE clause with column name as the condition
body: <p>I'm trying to do a select in a where clause, where the result of the case statement is the column name.</p>
  
  <p>Here's what I've tried:</p>
  
  <pre><code>declare @lang int -- this is passed to the stored procedure
  declare @productname nvarchar(300) -- this is passed to the stored procedure
  
  select productid from products where
  
      case 
      when @lang = 1 then producten
      when @lang = 2 then productit
      when @lang = 3 then productde
      end product like @productname
  </code></pre>
  
  <p>So, for english (@lang = 1) I want:</p>
  
  <pre><code>select productid from products where producten like @productname
  </code></pre>
  
  <p>I'm getting errors though and not sure what I'm doing wrong.</p>