Much simplier:
declare @ThisDate datetime;
set @ThisDate = getdate();
select
getdate() as CurrentDateTime,
dateadd(mm, datediff(mm, 0, @ThisDate) + 1, 0) as BeginningOfNextMonth, -- Beginning of next month
dateadd(mm, datediff(mm, 0, @ThisDate) + 1, -1) as BeginningOfNextMonth -- End of this month
You can find some more date routine here Some Common Date Routines