title: Can I use EXISTS keyword in sql query for assignment of result
body: <p>Can I assign a value with <code>EXISTS</code> in the query. Currently it is giving me error <strong>Incorrect syntax near '='</strong>. But when I uses this query only it runs as expected.</p>
  
  <pre><code>IF EXISTS (SELECT @PK_LOGIN_ID=PK_LOGIN_ID FROM dbo.M_LOGIN 
      WHERE LOGIN_NAME=@LOGIN_NAME AND PASSWORD=@PASSWORD AND FK_ROLE_ID=@FK_ROLE_ID)
              RETURN @PK_LOGIN_ID
      ELSE
              RETURN 0
  </code></pre>