Recover two weeks old stored proc which has changed since I accidentally changed a stored procedure on Microsoft 2016 SQL Database. Then I noticed the change after complaints from the reporting side. Made few changes and run but didnt work. Not it seems I need to recover the stored proc 2 weeks ago. Can someone explain the process.
There's no way to recover the code unless you restore a backup of the server taken prior to when you updated the database with your change. But I would just check your source control repository and re-run the prior version.
This is why one generally keeps stored procedures, triggers, table definitions and the like in a source control system, like e.g. Git. That would prevent this sort of situation from happening again and provide many other benefits, such as versioning.