It is recommended to castrate both of them. The smell of intact animal will excite even castrated one. In addition, this procedure of castration has a positive impact on the health of your dog. This situation may become worse if these two male dogs are still young. If they dealt significant damage to each other, it is recommended to keep them separate. Keeping two fighting dogs together is inhumane.
In wild nature, in such cases, one of the dogs will be forced to obey the strongest one, or to leave its pack. They are not able to do that in our houses. As an owner, you should separate your dogs and find another owner for one of them, if they can't live together after castration.
It is also recommended to take your dogs to discipline course (do it separately too) and make sure that they obey all your commands. It may help, if dogs start fighting in front of you, but it does not exclude the need to separate them.
More answers