OneNote does not support RTF format. It loses the text format when you paste RTF text.
You may copy the SSMS to Word first, then copy it from Word to OneNote as a workaround. The last part in following image is the SSMS copied from Word.
Or you can use 3rd-party add-in to Paste Rich Text.
Thanks for your understanding.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.