 <p>Your logic is equivalent to:</p> <pre><code>Select * From orders Where (Value1 &lt;&gt; 'TEST' and Value1 = @1) OR (Value1 = 'TEST' and Value2 &lt;&gt; 'TEST' and Value2 = @2) </code></pre> <p>This is not 100% equivalent. If <code>Value1</code> could be <code>NULL</code>, then the logic should take that into account:</p> <pre><code>Select o.* From orders o Where (Value1 &lt;&gt; 'TEST' and Value1 = @1) OR (COALESCE(Value1, 'TEST') = 'Test' and Value2 &lt;&gt; 'TEST' and Value2 = @2) </code></pre>