Well usage of Dynamic SQL has its pro's and Con's and I learnt from the article posted by Frank, however if you still want to go with it then it could be your solution
CREATE proc sp_doIt
@colName varChar(20)
as
declare @sql1 varchar(1000),
@sql2 varchar(1000)
set @sql1 ='Select distinct(' + @colName + '), count(*)
from theTable'
set @sql2 = ' group by ' + @colName
exec (@sql1+@sql2)
Prasad Bhogadi
www.inforaise.com