Without seeing the dynamic_pivot procedure I can't give you the solution you probably want. I'm going to agree with Eddie.
If the ID column is int you don't need to split the string. Try this:
DECLARE @ids VARCHAR(100), @sql NVARCHAR(1000)
SET @ids = '4,5,6'
SET @sql = 'Select * from sys.objects as o where o.object_Id in (' + @ids + ')'
EXEC (@sql)
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question