Like most things in poker, it depends.
First the easy stuff, no you're never folding KK or AA preflop. About 1 time in 20 that you have KK someone will have AA, and you'll win 1/5 of those. Too many times when you "know" the guy has aces, he'll have QQ, JJ, AK, something you destroy, so take your lumps with KK v AA preflop holdings.
In 6max, you should open raise all pp's, especially if you're aggressive postflop. You have the initiative, likely winning the hand on the flop anyway, plus any pair is a decent strength hand to start with, so you have something to fall back on if your cbet gets called.
At a 9max table, basically 22-JJ are decidedly weaker than QQ-AA, and should be played more for set value. Obviously the higher the pair, the stronger it is, because it's more likely to be an overpair to the board, but other than that, you really need to hit your set to get involved in a big pot. Top pair, overpairs, they're all still just one pair, so you're not looking to commit stacks with that.
What about the game itself. Is it easy? Tough? Agressive? Passive?
In a tougher or agressive game, then small pp's aren't going to be profitable in early position, because too often you'll limp and get reraised behind. Playing small pp's oop trying to make sets is NOT profitable against solid competition.
However, in a weak game that's passive with lots of limping, then go ahead and literally play any pair from any position. Bad players are more likely to pay you off with their own tptk holdings when you have a set, so implied odds
are through the roof, and position matters less.
Then you have to take stack sizes into account. You're 7:1 against hitting your set, so if you're being laid those explicit odds, you're good to go. However, you usually will only be getting 2:1 or something in that vicinity. So you have to be able to get paid off should you hit your set and get stacks in to make up for all the times you take a flop, miss, and fold.
So you want your opponnent's stack to be say 20-25 times the size of whatever bet you must call preflop to get enough implied odds for set value.
So in review:
6max or 9?
Tough or easy?
Stack sizes and odds
Take these factors into account to determine if a PP is worth playing.