title: Executing SQL Server stored procedure - Incorrect syntax near
body: <p>I am getting the following error.</p>
  
  <blockquote>
    <p><em>Msg 102, Level 15, State 1, Line 5<br>
    Incorrect syntax near '@ExcludedDivisionBracketPartIds'.</em></p>
  </blockquote>
  
  <p>I have no idea why this is happening.  If I execute the stored procedure directly it works fine.  </p>
  
  <pre><code>exec sp_executesql N'EXEC [TEST].[DeleteDivisionBracketPartsTEST]  
  @DivisionBracketId 
  @ExcludedDivisionBracketPartIds 
  @MemberId',
  N'@DivisionBracketId int,
  @ExcludedDivisionBracketPartIds nvarchar(max),
  @MemberId int',
  @DivisionBracketId=145,
  @ExcludedDivisionBracketPartIds=N'473',
  @MemberId=53
  
  ALTER PROCEDURE [TEST].[DeleteDivisionBracketPartsTEST]
      @DivisionBracketId INT,
      @ExcludedDivisionBracketPartIds NVARCHAR(MAX),
      @MemberId INT
  AS
  BEGIN
      SET NOCOUNT ON;
  </code></pre>