• Using this sample data:

    CREATE TABLE #myTable (dt date UNIQUE NOT NULL);

    WITH E AS (SELECT v FROM (VALUES (1),(1),(1),(1),(1),(1)) t(v))

    INSERT #myTable

    SELECT CAST(DATEADD(DAY, ROW_NUMBER() OVER (ORDER BY (SELECT 1))-1, '20140101') AS date)

    FROM E a, E b, E c, E d;

    You could do this:

    SELECT [date] = MAX(dt),

    [day] = DATENAME(WEEKDAY,MAX(dt))

    FROM #myTable

    WHERE DATENAME(WEEKDAY,dt) NOT IN ('Saturday', 'Sunday')

    GROUP BY DATEPART(YEAR,dt), DATEPART(MONTH,dt)

    ORDER BY MAX(dt); -- not required, including for readability

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001