I don't know how your code looks like. I found a thread similar to yours: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/87039167-7bb6-42dc-b20e-0dabf9a3f44b/sql72014-sql-execution-error-a-fatal-error-occurred-incorrect-syntax-was-encountered-while-?forum=ssdt, maybe you can use it as a reference.
If the answer is helpful, please click Accept Answer
and Up-Vote
for the same. If you have any questions, please feel free to let me know.
Best regards,
Aniya