How to have fresh basil cheaply in the kitchen

I’ve tried multiple times to grow basil in the garden with visions of making my own pesto. My problem every time is that the snails think it is delicious and voraciously eat them before my culinary visions can come to pass.
I’ve discovered that it’s far more realistic to simply grow a pot of basil (or in my case basil & one emergency lettuce) on the kitchen window sill. That way you’ll at least have enough basil for topping pizza or spaghetti bolognese (and it smells good too!).