Thanks for saving me from writing it from scratch, Divya!
David, I spotted your question too, and modified the query to always give me Mon=1 to Sun=7:
select 1+(datepart(dw, @date)+@@datefirst+5)%7
Adding 5 before the MOD effectively cycles the days backwards, then adding 1 afterwards fixes the zero.
Andy T