I've played and beaten them both. Very excellent games. Personally, I liked the story in KOTOR II more. I find it delved deeper into the Star Wars Extended Universe's history. That's just me though.
Two of the best RPGs out there, though. I wish BioWare would make another. I know that rumor was going around, but they won't confirm it. I wish they would, though. The KOTOR games are absolutely amazing.