I agree with DZ that what I’ve already got there has the makings of a pretty classic line. In a hypothetical world in which this was how the film was released, it’s a pretty meme-able thing to say whenever somebody asks who you are and/or what you’re doing there.
The only other alternatives I can think of atm are the following:
Trooper: “Who are you?”
“I had hoped you might be able to tell me?”
OR
“That’s precisely what I’m trying to figure out!”
Trooper: “Then why are you… what?”
Both of the alternatives are funny in their own right, but I think the idea of Threepio coming to the sudden realization that he’s “some sort of spy” and saying it in front of a stormtrooper like he’s proud of it has a slight edge. Plus, it lines up the best with his subsequent line about “his first laser battle” so we wouldn’t necessarily have to change that one, too.