You Could Try
Declare @SQL as nvarchar(Max)
,@SQL2 as nvarchar(Max)
-- Just Sample
-- each variable max 4000 character, so be wise in splitting your syntaxs
Set @SQL = 'Select * '
Set @SQL2 = 'From table A'
EXEC (@SQL+@SQL2)
Note if your dynamic string lenght more than > 8000 character you should split into 3 variables'
this should works, because i was have same problem