If you think I'm about to recommend what kind of pesto to buy, forget it! You should never buy pesto. Make it at home. It is so easy and so much better. When basil is in the summer, I like to make small batches that I can keep around for a few days to make for a quick and tasty lunch or dinner.
Use basil that has just been picked. You can get that by growing your own, buying it at a local farmer's market or some grocery stores sell small basil plants that are still alive with the root in water in a plastic bag.
Place in a food processor:
2 cloves of garlic, finely chopped first
2 cups of basil leaves, tightly packed
3 tablespoons of pinenuts
1/4 cup extra virgin olive oil
Process these together into a paste. Boil the water, add a lot of salt, and cook the spaghetti until al dente. Grate 1/2 cup of parmiggiano reggiano and 2 tablespoons of pecorino romano. Mix the two cheeses into the paste.
Before dumping the cooking water, scoop 1/4 cup of the water to use in the pesto. Now drain the spaghetti and put back into the pot to toss with the pesto. Add a little at a time until you right amount. You don't want too much green in there. You can add a little of the salty cooking water to help distribute the pesto. Now taste that. It should be delicious. You can add some butter for more deliciousness, but it's not necessary.
If you're not going to use all the pesto, don't add the cheese to the pesto you plan to save. You should add the freshly grated cheese only when you are ready to eat it. This recipe will make enough for 1 to 1 1/2 lbs of pasta, so you will have leftover if you're cooking for one or two people (1/4 to 1/2 lb).