IF is it a new CPU with same socket, then mostly you don't need to do anything, and windows will just update its drivers for the new CPU.
IF is it a new CPU with different socket, meaning you'll have a new motherboard as well. Then, you'll have to install motherboard drivers along with the new chipset driver. Also, you will need to make sure (before changing the motherboard) to register your Windows 10 product key to Digital Key to reactivate the windows 10 on the new motherboard. (This is optional if you have a retailer version of Windows 10, and mandatory if you have an OEM version of Windows 10)
To register your Product key to a Digital Key go to
Settings > Update & security > Activation and then sign in using a Microsoft email account (Hotmail, Live, Outlook, Microsoft ..etc). Then register your product key to your Microsoft Account, when you're done, you're ready to swap the motherboard and run the windows and use the same Microsoft account that you linked the digital key to it, and your windows will be activated.
Read more about it: