Hi oscarreeve,
Boiling oil is used automatically when any enemy unit is under a gateway. It it incredibly effective and usually causes anything it hits to die - very useful against tightly packed units and elephants should they be battering down your gates. Sadly it cannot destroy rams under walls, although it can destroy the troops holding them, and it has a very slow rate of use, about once every three-four seconds or sometimes even longer. Good luck with your stone walls, cheers!