title: How to select true/false based on column value?
body: <p>I have a table with the following columns:
  EntityId, EntityName, EntityProfile, .................</p>
  
  <p>I want to select the Id and Name and true/false column based on the value of entity profile,
  for example a returned result set like below, would mean that entities 1&amp;2 have profiles while 3 not.</p>
  
  <pre><code>1 Name1 True
  2 Name2 True
  3 Name3 False
  etc.....
  </code></pre>
  
  <p>I know I can do it using a function that return true/false based on the profile value like this:
  SELECT EntityId, EntityName, dbo.EntityHasProfile(EntityId) AS HasProfile FROM Entities</p>
  
  <p>but I'm returning a large no. of records and with this function call for each record, the query is very slow, and when I remove the function call the query execution time drops significantly.</p>
  
  <p>So is there another way of doing this?
  Thanks</p>