Another solution to the aforementioned problem:
select distinct cID into #temptable from yourTable
declare @var1 varchar(1000)
set @var1='SELECT vID'
select @var1=@var1+',MAX((Case WHEN cID='+quotename(cID,'''')+' THEN [value] ELSE null END)) AS ['+cID+'] ' from #temptable
exec (@var1+'...