Intuition
The steady state can be described using conduction as Kamran suggested. But since the fluid is not flowing, the outside convection might actually play a role. Intuitively, if you know the temperature at one end of the pipe and the environment temperature is lower, you would expect the pipe temperature to get closer to the environment temperature as you get farther from the end along the pipe. And as this temperature difference is decreasing, the rate of this decrease should also be decreasing, which suggest exponential function.
Derivation
Let's consider element of the pipe with infinitesimal length $dx$ along the axis. Heat flux which enters at one section will be equal to the sum of heat flux exiting at the opposite section and an infinitesimal heat flux to the environment:
$$\dot{Q}(x) = \dot{Q}(x+dx)+d\dot{Q}_{loss}(x)$$
In another form using Fourier law:
$$-\lambda\cdot A\cdot \frac{dT(x)}{dx} = -\lambda\cdot A\cdot \frac{dT(x+dx)}{dx}+\left(T(x)-T_{env}\right)\cdot \alpha\cdot C\cdot dx$$
where:
- $\lambda$ is the equivalent axial thermal conductivity of the pipe in combination with the fluid as well (as insulation if applicable)
- $A$ is overall section of the pipe including the fluid (and the insulation)
- $C$ is the outside circumference of the pipe (so $C\cdot dx$ is the outer area of the element in contact with the environment)
- $T(x)$ is the pipe surface temperature at distance $x$ from one of the ends of the pipe
- $T_{env}$ is reference temperature of the outer environment
- $\alpha$ is the heat transfer coefficient between the outer surface and the environment
Using a substitution $k = \frac{\alpha\cdot C}{\lambda\cdot A}$, the equation can be rewritten as:
$$\frac{d^2T(x)}{dx^2}-k\cdot T(x) = -k\cdot T_{env}$$
This is a differential equation with a general solution in the form (using WolframAplha):
$$T(x) = T_{env} + C_1\cdot \exp\left(\sqrt{k}\cdot x\right) - C_2\cdot \exp\left(-\sqrt{k}\cdot x\right)$$
where $C_1$ and $C_2$ are constants, which can be determined using 2 boundary conditions. In this case, these could be any 2 known temperatures along the pipe length.
Let's say we know both end temperatures $T_0=T(x=0)=150\text{ ยฐC}$ and $T_L=T(x=L)=200\text{ ยฐC}$ for the pipe with a length $L=15\text{ m}$, whose coefficient $k=3\text{ m}^{-1}$. The pipe surface temperature distribution along its length will look like this:
As you can see, the pipe temperature exponentially approaches the environment temperature as you get further from each of the ends.
Horizontal vs. vertical pipe
There will definitely be a difference between these 2. The vertical pipe will have higher equivalent conductivity $\lambda$ than the horizontal pipe. When there is temperature gradient in axial direction, there will most likely be some movement of the fluid, which will contribute to this equivalent conductivity. I am not sure how to calculate it, but you could also determine the required constants for the distribution experimentally.