title: SQL Dynamic Procedure
body: <p><img src="https://i.stack.imgur.com/ig1mF.jpg" alt="Code Error"></p>
  
  <p>I have being trying to execute this procedure:</p>
  
  <pre><code>go
  declare @idnvarchar(max)
  declare @dia nvarchar(max)
  set @id='E4211537-09CD-45F2-BB5F-F20F642DE676'
  set @dia='ObjectSignal_2016_05_23 '
  set @sqlstring = 'Select Code From ' +@dia+ 'WHERE IdObject='+@id+''
  EXEC sp_executesql @sqlstring
  go
  </code></pre>
  
  <p>But I'm getting the problem that is show in the image below. </p>
  
  <blockquote>
    <p>Mens. 102, Nivel 15, Estado 1, Linea 1</p>
    
    <p>Sintaxis incorrecta cerca de 'CD'.</p>
  </blockquote>