title: Replacing exist in SQL query for time optimization
body: <p>I have the following SQL that works spot on but with bigger data set has proven to time out</p>
  <pre><code>    insert into RolePermissions
      select      
          [ID],
          R.[ContractManager],
          @ActionType,
          null
      from Roles R
      where not exists
      (
          select 'x'
          from RolePermissions
          where [RoleID] = R.[ID]
          and [ActionType] = @ActionType
      );
  </code></pre>
  <p>Can anybody suggest a way to optimise this ?</p>