This has happened to me a few times. Without knowing it, the DM uses a module I have read or even run. I am always upfront with the DM once I relaize it and try to reduce the choices my cvharacter makes so that the party leads the group and not me. And that can be hard because lots of times I'm party leader. Now, I don't want the DM to not be able to run certain modules or take away from the experience of the other guys who have never gone through them.
Does this happen to others? What do you do? As a DM will you change things to make sure the player doesn't know or would you trust the player to not use the knowledge he has? Players, are you up front with the DM or do you hide the fact that you are familar with it? Do you act on the knowledge or try to diminish your importance?