title: Stored procedure with string parameters, how to get it work?
body: <p>I am trying to write a stored procedure which is taking two arguments to retrieve some data from customers table.</p>
  
  <p>Below is the stored procedure, it does not retrieve any data, however when I just type the select query, it works.</p>
  
  <p>Can somebody help me to see where is the problem?</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[RecordsByColumnSearch]
      @field VARCHAR(50),
      @search VARCHAR(50)
  AS
      SELECT *
      FROM Customers
      WHERE @field = @search
  </code></pre>
  
  <p>Executing this stored procedure like this:</p>
  
  <pre><code>EXEC dbo.RecordsByColumnSearch @field = CustomerID, @search = ALFKI;
  </code></pre>
  
  <p>does not return any data, while running this query does:</p>
  
  <pre><code>SELECT * 
  FROM customers 
  WHERE CustomerID = 'ALFKI';
  </code></pre>
  
  <p>Thank you in advance !</p>