title: IF EXISTS in T-SQL
body: <p>If we have a <code>SELECT</code> statement inside an <code>IF EXISTS</code>, does the execution stop as soon as it finds a record in the table? For example:</p>
  
  <pre><code>IF EXISTS(SELECT *  FROM  table1  WHERE Name='John' )
  
  return 1
  
  else
  
  return 0
  </code></pre>
  
  <p>If a row exists in the table with the name = John, does it stops execution and returns 1 or does it traverses through the entire table looking for more matches?</p>