If you're a junior developer, then, yes. Your role is baked into your title. Junior developers are brought on to do grunt work. It may sound a bit exploitative, but at the same time, doing the grunt work helps developers understand the code and become familiar with patterns and processes, especially as they relate to how your particular organization utilizes them.
Do things as your boss says to do them, but you can still get creative while coloring within the lines. Look for innovative ways to improve the efficiency, readability, and stability of your code. Make sure it's thoroughly tested, and think of edge-case scenarios to test. Just about any junior developer's code will be reviewed at some point, and if the reviewer consistently sees solid, efficient, fully-tested, and well-documented code, then your opinion will carry much more weight. Eventually, you might be able to suggest new ways of doing things, because you've then demonstrated a good work ethic and solid coding practices. You're also more likely to be promoted into a position with more autonomy at that point, as well.
Remember as well that for better or worse, the programming community is very caste-based. Senior developers do not always take kindly to junior developers thinking they know better, even if they do. Ultimately, you should display respect in all you do. Even if you know a particular developer, your boss, etc. are just flat-out wrong, don't just come out and say that. Instead, approach conflicts from a learning perspective. Ask your boss or whoever (kindly) to explain why a thing should be done the way they say it should, so you can truly understand. You can often begin conversations in this way and potentially pitch your ideas in a more relaxed manner, where your boss doesn't hear "you're wrong" as much as "let's work together to figure out the best way".
Finally, don't get cocky. All developers of every level of experience always think they're rockstars. It's a side effect of what we do, as the act of creation makes one feel god-like. The simple truth, though, is that there's always something new to learn and always areas where you can improve. I've been programming the majority of my life, and still learn new things every day, still have head-smacking moments of stupidity every day. That's fine. That's normal. The danger comes when you think you know everything, because then you're unteachable.