title: TSQL Dynamic Where
body: <p>I would like to do something ike this.</p>
  
  <pre><code>declare @var1 as integer
  
  Select * from table name 
  where id
  If @var1 = 1 then
   21 
  elseif  @var1 = 2
   &lt;&gt;21
  </code></pre>
  
  <p>All I would like to know is if this is possible. The only thing that needs to change is the comparison operator.</p>