Well it is possible indeed, but it depends on the phone version.
I have GT-I9505, and the phone had NOS (Portuguese Carrier) ROM, i've flashed an unbranded ROM and it worked.
But it's prefereble to simply install a custom ROM, much more cleaner and you can get ROMs with Samsung look but without...