title: Bypassing the WHERE clause when the filter parameter comes as null
body: <p>I have a procedure and need to bypass the WHERE clause where input as null.</p>
  
  <p>Please find the below condition.</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[spPERSON_SELECT]    
  (
  @PersonID INT = NULL,
  @OrganizationID INT = NULL,
  @ManagerID INT = NULL 
  )
  AS
  
  BEGIN
  SELECT PERSON.name, ORGANIZATION.name,PERSON.manager 
  FROM PERSON 
      INNER JOIN ORGANIZATION 
          ON PERSON.person_id = ORGANIZATION.person_id    
  WHERE PERSON.person_id = @PersonID  
      and ORGANIZATION.organization_id = @OrganizationID  
      and PERSON.manager_id = @ManagerID 
  
  END
  GO
  </code></pre>
  
  <p>Iam facing an issue while the input as null, at that case need to avoid where condition.</p>
  
  <p>Example:</p>
  
  <p>If @PersonID is null then my select query needs the following structure:</p>
  
  <pre><code>SELECT PERSON.name, ORGANIZATION.name,PERSON.manager 
  FROM PERSON 
      INNER JOIN ORGANIZATION 
          ON PERSON.person_id = ORGANIZATION.person_id    
  WHERE ORGANIZATION.organization_id = @OrganizationID
      and PERSON.manager_id = @ManagerID 
  </code></pre>
  
  <p>I would like to avoid dynamic queries.</p>