Killing with firearms is more fun and reliable. Sinking a boat with a cannonball in open ocean will probably result in killing the pirate anyway so why fool around and pretend there is something wrong with using firearms?
Large vats of sulfuric acid pumped through a special firehose would be a good start.
Molotov cocktails fired from specially built CO2 cannons when they come real close.
Having a dozen or so semi-automatic grenade firing shotguns. Just conceal them when you go into port.
Also, you have to have kill all the pirates, ie.no survivors, or the pirates will report the vessels and they will be barred from the ports.
Next thing you know poured cauldrons of flaming oil and catapulted boulders may be considered.