title: Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query
body: <p>I have the below select statement from a stored procedure:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[Test]  
     --Params 
     @SolutionId   INT 
     ,@APIKey    varbinary(256)   
  AS  
     SELECT 
         SK.SolutionID        
         ,SK.APIKey   
         ,SK.Enabled
      FROM    
         dbo.SolutionKey SK
      WHERE
         SK.SolutionID = @SolutionId 
         AND SK.APIKey = @APIKey 
         AND Enabled = 1
  </code></pre>
  
  <p>The issue is that <code>SK.APIKey</code> is a <code>varbinary</code> datatype but in the stored procedure from the code it is passed on as 'sampledata' and so I get the error</p>
  
  <blockquote>
    <p>Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.</p>
  </blockquote>
  
  <p>Can someone please tell me how can I resolve this?</p>