Dynamic PIVOT with Numbered Column Names

I'm getting the following when trying to pivot a table:

Country  Birmingham  Dallas  New Delhi
---------------------------------------
India    NULL        NULL    New Delhi
UK       Birmingham  NULL    NULL
USA      NULL        Dallas  NULL

However, I'm trying to get this (the total amount of distinct cities per country):

Country City1        City2          City3
----------------------------------------
India  New Delhi     Bangalore      Hyderabad
UK     London        Birmingham     Portsmouth
USA    Dallas        Indianapolis   Houston

This is the code I'm currently using:

-- Dynamic Pivot
declare @dynamicPivQuery as nvarchar(max)
declare @colName as nvarchar(max)

--get distinct values of the pivot column
select @colName = 
    coalesce(@colName + ',','') + quotename(city)
    from (select distinct city from countries) as B
    order by b.city 



--Prepare the PIVOT query using the dynamic
SET @dynamicPivQuery =
    N'select Country, ' + @colName + '
    from countries
    pivot (MAX(City)
        for City in (' + @colName + ')) AS PIV'

EXEC sp_executesql @dynamicPivQuery 

Table Countries
  Country nvarchar(50)
  City    nvarchar(50)

I'm trying to figure out if I could use something like:

'City' + CAST(Row_Number() over (partition by country order by country) as Varchar(10))

I am using a SQL 2005 server with a database still in 2000 compatibility mode.

Thank you


ANSWERS:


SELECT Country, [1] AS City1, [2] AS City2, [3] AS City3
FROM 
(
    SELECT 
        Country, 
        City,
        ROW_NUMBER() OVER(PARTITION BY Country ORDER BY Country) Seq
    FROM Countries
) s
PIVOT
(
    MAX(City)
    FOR Seq IN ([1], [2], [3])
) p

Which results in:

Country City1       City2           City3
India   New Delhi   Bangalore       Hyderabad
UK      London      Birmingham      Portsmouth
USA     Dallas      Indianapolis    Houston


 MORE:


 ? SQL Server dynamic PIVOT query - fields order
 ? T-SQL dynamic pivot
 ? T-SQL dynamic pivot
 ? T-SQL dynamic pivot
 ? Converting Row to Column dynamically in SQL
 ? I'm currently looking for a dynamic way to convert rows to columns in a specific way in SQL server
 ? Microsoft SQL Server: Adding New Column To Row Instead Of Repeated Values
 ? Joining tables and LEFT JOIN as new Columns in tsql
 ? SQL query which returns variable number of columns for each record combining multiple rows
 ? Convert row to columns SQL dynamically