There are two parts to implementing version control for your SQL Server database objects. One is technical, and the other is mostly process.
- As you mentioned, script the objects out into text files and add them to your version control system (git)
- By the way, you would ideally include the full definition of the database - not just stored procedures and functions, but table and index definitions, etc.
- There are products available that make this experience better than just having a bunch of text files in a folder - like Microsoft's SSDT database projects, which work with Visual Studio (and now VS Code)
- Make sure that the version control system is always up-to-date with the latest code
Item #2 is generally harder for folks to implement than item #1. It generally means that you avoid making changes directly to production databases. Ideally you'll be deploying "from source" - meaning you make the changes to the source code, and then deploy to the database.
Tools exist for doing this in an automated fashion (like SSDT / dacpac deploys). You could also use "change scripts" or "migrations scripts", which would also be stored in git, alongside the updated source files.
A good primer on the different approaches for deploying from source is here: Critiquing two different approaches to delivering databases: Migrations vs state