Sailing boats with a keel usually resist capsizing because as they heel over the keel is pushed to windward at a greater angle, increasing the righting force it provides to the hull. Additionally the greater angle of heel decreases the area of sail that’s being exposed to the wind, further increasing the overall effect of the righting force. It would be interesting to see how these can be retrofitted to an ordinary cargo ship though, sailing boats are optimised for a particular amount of heel whereas as far as I’m aware cargo ships generally aim to avoid heel altogether as far as possible with large ballast tanks where water is pumped around.
I still don't think using traditional sails is practical though, and kites are a far more elegant and useful solution. They require far less cost and are easier to retrofit onto existing hulls, can be easily scaled up or down depending on wind conditions, and in the event of even catastrophic failure are pretty safe (i.e. if the kite line were to break). The biggest danger of them is the kite line falling in the water and getting fouled on the propellers, but this is a solvable problem.