Creating a Dynamic Select Statement from 2 databases on the same server
The first thing you should improve is to split this method into two methods, one for parsing the input string and one for  building a new query. Doing both in the same method isn't a good practice. 

This means that the first method should return a collection of columns that the other one consumes.