Here are some examples for renaming SQL Server objects using T-SQL.
I’m using SQL Server 2022, but these examples should work for most versions.
For sp_rename or sp_renamedb, the first parameter is for the current name of the object, and the second parameter is the new name.
You can use brackets around the object names in the first parameter for the current name, but using a bracket in the new name will include that bracket in the object name.

Rename a database:

EXEC sp_renamedb 'OldDbName', 'NewDbName';

You’ll need to make sure no one is connected to the database that you want to rename, this command will need an exclusive lock.

For most other objects, you can use sp_rename.

Rename a table:

EXEC sp_rename 'schema.OldTable', 'NewTable';

The renamed table will be in the same schema, you can’t specify a different schema for the renamed table. You can see this post to move a table to a different schema.

Rename a column:

EXEC sp_rename 'schema.table.OldColumn', 'NewColumn';

The third parameter usually isn’t required, but it can be used here as well.

EXEC sp_rename 'schema.table.OldColumn', 'NewColumn', 'COLUMN';

Rename an index:

EXEC sp_rename 'schema.table.OldIndexName', 'NewIndexName';

Note that the schema and table name must be included.
This same syntax can be used to rename a Primary Key, or any other type of constraint.

Links:
Microsoft – sp_rename

Microsoft – sp_renamedb

Database.Guide -Rename a Column in SQL Server (T-SQL)