title: SQL Query - Add condition in WHERE only IF another condition
body: <p>I want to do something like this in a where clause</p>
  
  <pre><code>WHERE ( i.accountid = @accountid 
        AND CASE WHEN @IsTest IS NOT NULL THEN b.IsTest = @IsTest ELSE 1 = 1
  </code></pre>
  
  <p>But this solution does not work. Is there any solution for this. Basically I want to add a verification based on <code>@IsTest</code> value.</p>