my table1 is :
col1 col2
C1 john
C2 alex
C3 piers
C4 sara
and so table 2:
This task cannot be solved with standard SQL. In Oracle I would write a stored function (PL/SQL) to parse the Name-ID-string (T2 col2) and resolve the names. Don't know if that's possible in Transact-SQL, but it's glorious inefficient.
T2 is a badly designed, not normalized table. That's the problem. If you would normalize it, so that you have one line per Name-ID (col 2 in T2), you can get the list of names with a simple join of the two tables. To generate the desired output format (comma delimited) you need to write something else than SQL - maybe a stored procedure or something else that iterates over the resultset.