title: How can i optimize this stored procedure Without Join
body: <p>I have a situation like this to a instant search but this query have more NOT IN check</p>
  
  <pre><code>ALTER PROC [dbo].[DPR_SP_GetEmployeeDetailsByKeyword]
  @keyword varchar(10),
  @hotelId int
  AS
  BEGIN
  SELECT  EmployeeDetails.EmployeeId,EmployeeDetails.SageEmployeeId,EmployeeDetails.FirstName,EmployeeDetails.LastName
  FROM    EmployeeDetails
  WHERE   (EmployeeDetails.EmployeeId NOT IN (    SELECT  EmployeeWorksIn.EmployeeId
                                                  FROM    EmployeeWorksIn
                                                  WHERE   EmployeeWorksIn.HotelId=@hotelId
                                                  )
  AND
          EmployeeDetails.EmployeeId LIKE @keyword+'%')
          OR
          (EmployeeDetails.EmployeeId NOT IN (    SELECT  EmployeeWorksIn.EmployeeId
                                                  FROM    EmployeeWorksIn
                                                  WHERE   EmployeeWorksIn.HotelId=@hotelId
                                                  )
          AND
  OR 
          (EmployeeDetails.EmployeeId NOT IN (    SELECT  EmployeeWorksIn.EmployeeId
                                                  FROM    EmployeeWorksIn
                                                  WHERE   EmployeeWorksIn.HotelId=@hotelId
                                                  )
          AND
          EmployeeDetails.DateOfBirth LIKE @keyword+'%')
  </code></pre>
  
  <p>How can I optimise this query </p>
  
  <p>Thanks</p>