title: Initialize output parameters in stored procedure
body: <p>I have a stored procedure with an output parameter that I initialize with "0":</p>
  
  <pre><code>ALTER PROCEDURE dbo.SomeProcedure
      @someparam INT = 0 OUT
  ...
  </code></pre>
  
  <p>However, when the procedure does not modify or set that parameter during execution, the output value is NULL, not "0" as expected.</p>
  
  <p>Is it mandatory to set the default value in the procedure code</p>
  
  <pre><code>SET @someparam = 0; 
  </code></pre>
  
  <p>and avoid the initialization in declaration? </p>
  
  <p>Why SQL Server allows default values in declaration for output parameters then?</p>