title: SQL if( exists()) query duplication
body: <p>I need to write a a query that gets a set of information from a table, but if there is no information for that specific client, then use the default set.  I was wondering if there is a way to avoid query duplication in an if(exists()) statement.</p>
  
  <p>For example:</p>
  
  <pre><code>IF( EXISTS( SELECT * FROM UserTable WHERE Name = @UserName))
  BEGIN
      SELECT * FROM UserTable WHERE Name = @UserName))
  END
  ELSE
  BEGIN
      SELECT * FROM UserTable WHERE Name = 'Jon Skeet'))
  END
  </code></pre>
  
  <p>The first two selects (exists and the true part of the if) are the exact same.  I want to avoid running the same query twice if the statement is true.  I know the exists stops once the first true condition is met but that is still O(n) worst case.</p>
  
  <p>Another option I know of, is put the information in a temp table and check if information is there, if not return the default information.</p>
  
  <p>Both ways would work but what is the best way to do it?  Are there other ways to do this?  Is there some way to do this in the WHERE clause since that's the only thing that is different?</p>
  
  <p>Edit:  Fixed example to return a row not just a single item.  So the answers of dumping the select to a single variable would be equal to a temp table I assume.  Also, to not anger Jon Skeet, spelled his name right</p>