Incorrect syntax near the keyword 'FROM' when using MS SQL Server 2012

It does not depend on where from it is called. A sort set with columns that have a lookup with multiple columns in ValueDisplayMember produces TRIM function in the SQL, which is supported from MSSQL 2017 and up.