To change the code on a combination lock, open the lock using your code or the manufacturer's code (it should be 0000) if you are using the lock for the first time. Follow the manufacturer's instructions on how to change the code on the lock, as various models of locks work differently. Use a reset tool to manually change the code if your lock comes with one.
To change the code using a reset tool, put the tool in the hole that is located on the side of the lock, press it forward, and rotate the tool by 90 degrees in any direction. Turn the wheels until you set the combination you would like to use for the lock. After that, rotate the tool again, and take it out of the lock. Make sure to record the code and keep it somewhere where nobody else is going to have access to it. These are general guidelines; instructions on how to use a reset tool might be slightly different depending on the manufacturer.
Some combination lock manufacturers have special storage vaults where customers can keep combinations to their locks. If you forgot the combination and the lock can't be reset using a special tool, contact a locksmith to open it, and then reset the combination. You can also use bolt cutters to open the lock, but you are going to have to repair the lock after that.