Try this :
declare @year int
set @year = 2011
declare @month int
set @month = 12
declare @sd as datetime
declare @fd as datetime
set @sd = CAST(CAST(@year AS varchar) + '-' + CAST(@month AS varchar) + '-1' AS DATETIME)
set @fd = DATEADD(DAY, -(DAY(DATEADD(MONTH, 1, @sd))), DATEADD(MONTH, 1, @sd))
while @sd<=@fd
begin
if datepart(dw, @sd) = 6
print cast (@sd as varchar(max)) + ' is Friday.'
set @sd = DATEADD(DAY, 1, @sd)
end;
Good Luck.