title: Pass WHERE clause as parameter into a SQL Server stored procedure
body: <p>I am working on a stored procedure where one of the parameters used in <code>WHERE</code> clause needs to be sent from the code. For ex - </p>
  
  <pre><code>CREATE PROCEDURE sp_test
      @param1 
  AS
  BEGIN
      SELECT * 
      FROM Table 
      WHERE @param1
  END
  </code></pre>
  
  <p>In the above stored procedure, the value passed to <code>@param1</code> would be something like <code>Col1 LIKE '%abc%' AND col1 LIKE '%xyz%'</code> I understand that this can be done using dynamic SQL, but I would prefer not to use this.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have a <code>varchar(MAX)</code> column and I am looking for searching this column based on values entered by the user. The operator used (AND / OR) is selected by the user on the front end. This is inline to the question asked <a href="https://stackoverflow.com/questions/51608427/convert-boolean-text-search-into-sql-query-where-clause">here</a></p>