title: Function hanging on @Variable input, but not with hard coded integer
body: <p>Very odd problem.  This function has randomly started hanging and timing out when I call it like this:</p>
  
  <pre><code>DECLARE @persId int 
  SET @persId = 336
  
  SELECT  * FROM  [CIDER].[dbo].[SMAN_ACL_getPermissions]   (
    null
    ,@persId
    ,1
    ,null)
  GO
  </code></pre>
  
  <p>But returns super quick when I call it like this:</p>
  
  <pre><code>SELECT  * FROM  [CIDER].[dbo].[SMAN_ACL_getPermissions]   (
    null
    ,336
    ,1
    ,null)
  GO
  </code></pre>
  
  <p>Could someone please highlight the difference between these two me?  It's making debugging very hard...</p>