title: SQL Server stored procedure does not return value
body: <p>I have a table with some data and I have written a stored procedure to return a count of the rows:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[SP_User_Case_Answer_Found]
      @userID BIGINT,
      @visitID BIGINT
  AS
      RETURN 
          SELECT COUNT(*) 
          FROM User_Case_Answer
          WHERE userID = @userID
            AND pvisitID = @visitID
  GO
  </code></pre>
  
  <p>and when I execute it I get:</p>
  
  <pre><code>DECLARE @return_value int
  
  EXEC    @return_value = [dbo].[SP_User_Case_Answer_Found]
          @userID = 26,
          @visitID = 5
  
  SELECT  'Return Value' = @return_value
  GO
  </code></pre>
  
  <p>But the return value = 0? I am sure the table contains data.</p>