title: What is the best way to check for the existence of a Login in SQL Server 2005
body: <p>I am looking for the best way to check that a database login exists in SQL Server 2005. I am currently using </p>
  
  <pre><code>IF suser_sid('loginname') IS NOT NULL 
  </code></pre>
  
  <p>but suser_sid() returns a value in some cases where a login does not exist. </p>
  
  <p>In SQL 2000 we use </p>
  
  <pre><code>SELECT * FROM [Master].[dbo].[sysxlogins] WHERE [name] ='loginname'
  </code></pre>
  
  <p>but that table does not exist in SQL 2005.</p>
  
  <p>There is a similar question about <a href="https://stackoverflow.com/questions/356000">checking the existence of Users</a>, which is helpful, but I am looking for the existence of Logins.</p>