Hello @Guduru, Harihara Prasad and welcome to Microsoft Q&A.
This error message is saying there is a mistake in the query. You mentioned this happens with tables which contain the same column name. Is the column name "Order" by any chance?
"order" is a reserved keywork in SQL, as in Select name, id from mytable order by name desc;
You mentioned using a lookup. Might this be to fetch column names to add into the query? like Select @{item().columnName} from @{item().tableName};
?
If so, I can imagine the result looking like Select Order from mytable;
This would cause the above error.
to use reserved keywords as names, enclose them in [brackets] like Select [Order] from [mytable];
This can be accomplished like @concat( 'Select [' , item().ColumnName , '] from [' , item().tableName , '];' )