Have your sons create their own Apple accounts. How you do this depends upon the age (13 or above in most countries).
How to create a new Apple ID - Apple Support
Create an Apple ID for your child - Apple Support
Have the sons sign out of your ID on their phones. Normally at that stage you would erase the phone, but do not do that. Now have them sign into their IDs. They will be asked if they want to erase information from the previous ID. Say no, unless you don't care about that information group. So, for example, if your account has photos they took, saying no means the photos will remain. You may, however, wish to go through and delete items on their devices after they have signed in that are personal to you.
I don't know if this will retain things 100%. I don't play any games on my devices and I don't know if this will retain things such as game scores or if those are ID specific.
Regardless of age you will need to set up Family Sharing so they can continue to update apps and have access to other items.
Here's more information related to what you are doing:
Merging Apple accounts (IDs) or transferring data is not officially supported, nor can it be done easily or completely. Read the links below for things you may need to do to transfer as much as is possible.
Sign out of iCloud on your iPhone, iPad, iPod touch, Apple TV, or Mac --> Sign out of iCloud on your iPhone, iPad, iPod touch, Apple TV, or Mac - Apple Support
If another Apple ID is signed in you may need to enter the password for that ID to sign out of that ID first.
Click on this link to learn how to 'Sign in with your Apple ID' --> Sign in with your Apple ID - Apple Support
Apps and media bought with one ID are permanently associated with that ID. Look into using Family Sharing to continue to be able to use items purchased with one Apple ID with other Apple IDs.
- Family Sharing - What is Family Sharing? - Apple Support
- Set up Family Sharing - Set up Family Sharing - Apple Support
Share folders with iCloud Drive --> Share files and folders in iCloud Drive on iCloud.com - Apple Support
Read How to use Shared Albums in Photos on your iPhone, iPad, and Mac - Apple Support about about how to share photos.
Additional contributor posts:
- Apr. 2018 post by ASC helper Winston Churchill on transferring data from one Apple ID to another. Can I merge two iCloud accounts - Apple Community
- Feb. 2021 tips from Eric Root Apple ID - Apple Community