WHILE (MONTH(@FirstDate) <=12 AND YEAR(@FirstDate)=@Year)
BEGIN
SET @DayofWeek = DATEPART(weekday,@FirstDate)
--First working day of the month
IF(@DayofWeek = 7)
SET @FirstWorkingDay= @FirstDate+1
ELSE IF (@DayofWeek = 6)
SET @FirstWorkingDay = @FirstDate+2
ELSE
SET @FirstWorkingDay = @FirstDate

--Get Last working day of the month
SET @LastDate=DATEADD(mm,1,@FirstDate)-1
SET @DayofWeek = DATEPART(weekday,@LastDate)
IF(@DayofWeek = 7)
SET @LastWorkingDay = @LastDate-2
ELSE IF (@DayofWeek = 6)
SET @LastWorkingDay = @LastDate-1
ELSE
SET @LastWorkingDay = @LastDate

SELECT @FirstWorkingDay AS FirstDay, @LastWorkingDay AS 'Last Day'
SET @FirstDate=DATEADD(mm,1,@FirstDate)
END