title: Varchar variable is not working in WHERE clause
body: <p>Why does this work...</p>
  
  <pre><code>DECLARE @MyInt int = 12345;
  SELECT * FROM MyTable WHERE MyId = @MyInt; --Returns 1 row
  SELECT * FROM MyTable WHERE MyId = 12345;  --Returns 1 row
  </code></pre>
  
  <p>but this doesn't?</p>
  
  <pre><code>DECLARE @MyVarchar varchar = 'ABCDEF';
  SELECT * FROM MyTable WHERE MyId = @MyVarchar; --Returns 0 rows
  SELECT * FROM MyTable WHERE MyId = 'ABCDEF';   --Returns 1 row
  </code></pre>
  
  <p>SQL Server version is 10.50.1746</p>