I personally enjoyed KotOR 2 significantly more than KotOR 1. I found the characters more interesting, the storey more complex and compelling and I liked that the ambiguity regarding the antagonists, both in terms of their motivations and identities. On balance I found KotOR 1 to be somewhat overrated.
In the interests of fairness however, there are a couple factors that should be taken into account regarding that opinion. First off I didn't play either game until just a few years ago, so by which point I'd heard a lot of praise for the first game and a lot of negativity regarding the sequel. As a result I felt KotOR was more than a little overrated while KotOR 2 felt like a pleasant surprise. Also, "the" twist regarding Revan was already spoilt for me, so it had zero impact. And finally, knowing ahead of time that the game was a buggy mess, I installed the TSLRCM mod straight away, so I've never played KotOR 2 in the state in which it was released.
Despite all that though, I still think KotOR 2 deserves extra points for ambition and substance, even if the execution was hobbled by an unreasonably truncated development time. My only real complaint is that for an RPG, there's a disturbing amount of linearity and the ship got shot down or otherwise grounded *way* too often.