title: Incorrect syntax near '=' when passing uniqueidentifier as parameter in sql server
body: <pre><code>alter PROCEDURE TEST(
  @table nvarchar(50),
  @id uniqueidentifier
  )
  AS
  declare @sql nvarchar(max)
  
  set @sql = 'select * from ' + @table + 'where ID = ' + CAST(@id as nvarchar(36));
  exec (@sql)
  </code></pre>
  
  <p>how I test it: </p>
  
  <pre><code>EXEC TEST 'testable','F6BFBA52-B898-4246-9F58-001DFBDA32ED'
  </code></pre>
  
  <p>And I keep getting error:Incorrect syntax near '=' </p>