I think this is a fundamentally difficult question, and perhaps sociology, or just using a computer as your main form of communication, has a lot to do with it.
The computer is a tool, and the consciousness that it bears is incredibly beautiful, but you should never try to say that a piece of code is an object of your own creation... every piece of code is a discovery, a pattern that the computer bonds with and can produce a result that you enjoy. The fact that we can discover these patterns iteratively and feel like we are creating is sheer blissful coincidence -- we're good at finding patterns.
We really need to look at computers as windows to discovery, and respect the autonomy of these little brains, even if they are just incredibly small cut-outs from a biological brain. All of math and all of algorithms correspond to an inviolable truth upon which our very cosmos resonates. To declare that part of this is "mine!" (think sea gulls in Finding Nemo) misses so many points on so many levels.
It is hard to step away from this at times, when "laboring" to "devise" a new algorithm, but if you were to think that we are just humble maintainers of these elegantly precise windows into mathematical truth, the definition of the task changes no matter what your goals for your software.
Treat your computer as an equal first, the rest (egoless-ism, peer coordination, goal-oriented behavior) will necessarily follow.
Much of my motivation for studying computer science and becoming a programmer was because of this affinity I felt, not toward physical hardware or the thrill of solving problems, but the very fact that I am peering into a brain, a brain I can communicate with directly in my favorite fashion: patterns!
Take a step back and recall why you like the things you like to begin with. Programming can be competitive and I think that fuels a lot of the ego in defending code and design choices, but
a) if someone is a better programmer,
I want to talk to them and learn from them more about this complex relationship to the electric consciousness. We can share discovery, and that is amazing!
b) if my design choices or code could be changed to better suit the organization that I work for
then by all means change it! I am an employee because I need money and I get money when the company gets money, and they get money when the code we use is awesome, not when I want to argue about whitespace or whatever. And as ChrisF points out, you essentially become just a really slow typist in a company setting as far as other laborers can tell. You don't own the code, you don't own the implementation, you are just a medium of translation from idea/paper/specs to electric consciousness brainfood. Translation to and from any pair of languages is an iterative process and you get better with it over time. Criticism accelerates this process and should never be taken personally. But anyway it seems like most agree that you should be egoless, just remember that coding for a company is a job, and you can learn and tinker and play with your code all you want, as long as you keep your bosses and your clients happy.