Remove @AsOfMonth and @AsOfYear from the outer function's definition and use:
Year(GetDate()) or DatePart(Year, GetDate())
Month(GetDate()) or DatePart(Month, GetDate())
You can convert this to VARCHAR as needed, but would actually expect month and year values to be passed around as INT.