There are several ways to protect a script from users who have editor access to the spreadsheet, depending on the nature of the script.
If the script runs when a time-driven trigger fires, it can be implemented as a stand-alone script project that nobody else has access to.
If the script contains UI code such as dialog boxes or sidebars, you willwould have to rewrite the script as an add-on.
The third option is to implement the script as a library with only a few short stub functions in the script project that is bound to the spreadsheet, and the rest of the code in the library.