It is comparatively easy to replace the sky in Photoshop when the horizon line is more or less even. But when there are buildings, or, as in this case, the rocks, projecting into the sky area, it get somewhat difficult.
Open both the images side by side – the one in which you wish to replace the sky (let’s call it ‘A’) and the good sky image (‘B’).
In our case, ‘A’ has some color in the sky. If we don’t get rid of it, the new sky will bear that color. So select the sky with whatever method you are comfortable with, and press the Delete key. Save the selection .
Now activate ‘B’ by clicking on its blue title bar and do a Ctrl + A (select all) and Ctrl + C (copy). Now activate ‘A’ and do a Ctrl + V (Paste).
Go to Blending mode and select Multiply (click on the small downward pointing arrow in the Layers palette where it says Normal, and select Multiply). The sky image will merge with the rocks image as you can see in the printscreen, but the sky will be superimposed also on the rocks.
Add a Layer Mask by clicking on the icon of the same name at the bottom of the Layers palette.
Select the Gradient tool. Ensure that Black is the foreground color and that you have selected Foreground to Transparent in the Gradient Picker. Drag vertically (from down to up) as shown in the Printscreen. You will notice that while the lower area is OK, the rocks still have the new sky over them.
Load the sky selection (Select>Load Selection). Inverse the selection so that the lower area is now selected (Shift + Ctrl + I) Using the Brush tool (black as the foreground color), simply brush away the sky from the rocks. Don’t worry about the brush going into the sky area because the sky area is protected by the selection. Deselect (Ctrl + D) Save the file using the Save As command.