Piano teachers always ask their pupils to practice scales. It's seen as a chore, and many pupils wonder why they have to do it.
Well, the answer is, to solve your problem. Practising scales, arpeggios and ultimately chords and pieces in a particular key, teaches you the sharps and flats in that key. It teaches you the fingerings that work in that key.
Playing in C major is easy for beginners because you don't have to think about black keys. But at intermediate stage and beyond, it's not most players' favourite key because the position of the black keys in other keys can facilitate more fluid hand movements.
For example, you'll probably find that you can soon play a D major upward scale faster and more fluidly than a C major scale because as your third finger sits on F#, it leaves a bigger gap and a better angle for your thumb to reach G, than in the C major scale getting from E to F.
Which keys to practice first?
- Books for beginners will introduce keys in a thought-out order
- You could work around the circle of fifths as @Shevliaskovic suggests, learning keys with one sharp/flat, then two, then three etc.
- If you're more interested in pop/rock, then you could concentrate on the commonest rock/pop keys, which tend to be influenced by what guitarists like: G, A, E, D etc. -- use the keys given in any transcriptions you use.
Perhaps you also want to be able to work out chord progressions on the fly. In that case you need to also learn "working sets" of chords for every key you learn. To start with, I, IV, V are enough. Maybe add the minor VI.
- C, F, G, Am
- D, G, A, Bm
- E, A, B, C#m
... and so on.
For a pianist, this is pretty easy if you know the scale. You can take a few moments to remind yourself of those chords - which will all use only notes from the scale - before playing the piece. In more complex songs, more chords will crop up, but you can derive them on the fly as long as you know the scale.
Of course, there are more complicated pieces which break the rules and have accidentals. You just have to deal with these as you find them.