I ran into the same issue using Microsoft's SMO objects in C#. I opened a case with Microsoft and they confirmed that there was a bug. As you discovered, the problem is that when you rename an object whose definition is contained in sys.sql_modules the object gets renamed in sys.objects, but the source code is not modified in sys.sql_modules.
Interestingly, the people responsible for SQL Server Management Studio have "fixed" the problem in their code. Whenever you script a stored procedure through the right-click menus the new (correct) name appears in the script even though the old name appears in the sys.sql_modules record for that stored procedure. Apparently, they rebuild the definition line up to the AS keyword and then concatenate the rest of the script from sys.sql_modules. What a kludge!!!
Why not fix the underlying problem? When you rename an object whose definition appears in sys.sql_modules, replace the old name with the new name in the object definition script in sys.sql_modules!